package com.algrithom.dp;

import java.util.Arrays;

/**
 * 求路径个数
 */
public class Solution6 {
    
    public static void main(String[] args){
        System.out.println(countPath(3,3));
    }
    
    private static int countPath(int row,int col){
        int[][] result = new int[row][col];
        for (int i = 0; i < row; i++) {
            Arrays.fill(result[i],1);
        }
        for (int m = 1; m < row; m++) {
            for (int n = 1; n < col; n++) {
                result[m][n] = result[m - 1][n] + result[m][n - 1];
            }
        }
        return result[row - 1][col - 1];
    }
}
